import os

import pytest
import logging,yagmail


def Email(filepath):
    email=yagmail.SMTP(user='1522057104@qq.com',password='mhszldzvffpnjfcc',host='smtp.qq.com')
    email.send(to='1522057104@qq.com',subject="这是国庆作业",contents='国庆作业',attachments=filepath)


def Log():
    logging.basicConfig(level=logging.DEBUG,
                        filename='log.txt',
                        filemode='w+',
                        format='%(message)s %(asctime)s %(levelname)s %(filename)s %(lineno)s')




if __name__ == '__main__':

    Email(['log.txt','baogao.html'])

    pytest.main([r'D:\gao1\GQzy1\conftest\conftest.py','--html=baogao.html'])
    pytest.main([r'D:\gao1\GQzy1\conftest\conftest.py', '-s', '--alluredir=./conftest/allure-result', '--clean-alluredir'])
    os.system('allure generate ./conftest/allure-result -o allure-report --clean')
    Log()
    pytest.main([r'D:\gao1\GQzy1\conftest\conftest.py', '-s'])